<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 用正则验证一个数是否在0-666之间 -->

    <script>
      //   var num = /^(\d|[1-9]\d|[1-5]\d{2}|6[0-5]\d|66[0-6])$/;
      // var reg = /(^[0-9]$)|(^[1-9][0-9]$)|(^[1-5][0-9][0-9]$)|(^6[0-5][0-9]$)|(^66[0-6]$)/;
      var num = /^(66[0-6]|6[0-5][0-9]|[0-5]?[0-9]?[0-9])$/;

      var reg = "667";
      console.log(num.test(reg));
    </script>
  </body>
</html>
